import { PickerView } from 'antd-mobile';
import React, { Component } from 'react';
import FilterFooter from '../../../../components/FilterFooter';

export default class FilterPicker extends Component {

  state = {
    value: this.props.defaultValue
  };

  onCancel = () => {
    this.props.onCancel();
  };

  onOk = () => {
    this.props.onSave(this.props.type, this.state.value);
  };

  handleChange = (val) => {
    this.setState({
      value: val
    });
  };
  render() {
    return (
      <>
        {/* 选择器组件： */}
        {/* <PickerView data={province} value={null} cols={3} /> */}
        <PickerView data={this.props.data} value={this.state.value} cols={this.props.cols} onChange={this.handleChange} />

        {/* 底部按钮 */}
        <FilterFooter onCancel={this.onCancel} onOk={this.onOk} />
      </>
    );
  }
}
